﻿@if (Model != null && Model.TotalItemCount > 0)
{
    var showMore = false;
    var p = Model.PageIndex;
    var tpc = Model.TotalPageCount;
    <!-- 分页 -->
    <div class="pagination text-right">
        <span class="total-count">共@(Model.TotalItemCount)条记录</span>
        <ul id="small-fb">
            @{
    if (p - 1 > 0)
    {
        <li>
            <a class="active" href="javascript:void(0);" data-pageindex="@(p - 1)">
                <i class="fa fa-caret-left"></i>
            </a>
        </li>
    }

    // start page index
    int start = p - (10 / 2);
    if (start + 10 > tpc) { start = tpc + 1 - 10; }
    if (start < 1) { start = 1; }

    // end page index
    int end = start + 10 - 1;
    if (end > tpc) { end = tpc; }
    if (end + 1 <= tpc) { showMore = true; }

    for (int i = start; i <= end; i++)
    {
        var a = "";
        if (i == p) { a = "active"; }

        <li><a class="@a" href="javascript:void(0);" data-pageindex="@i">@i</a></li>
    }

    if (showMore)
    {
        <li><a href="javascript:void(0);" data-pageindex="@(end + 1)">…</a></li>
    }

    if (p + 1 <= tpc)
    {
        <li>
            <a class="active" href="javascript:void(0);" data-pageindex="@(p + 1)">
                <i class="fa fa-caret-right"></i>
            </a>
        </li>
    }
            }
        </ul>
    </div>
    <input type="hidden" id="skipPage" name="skipPage" value="1" />
    <script src="~/Areas/Admin/HTML/js/pager.js"></script>
}
<input type="hidden" id="order" name="order" />
<input type="hidden" id="by" name="by" />
